﻿
' Scratch Testing Module for testing code snippets.
' Not used / needed for main application

Module Test

    Dim oLog As Logger = LoggerFactory.getLogger("Test")
    Dim pdw As Window


    Sub main1()
        ' Get the your application's application domain.
        Dim currentDomain As AppDomain = AppDomain.CurrentDomain

        ' Define a handler for unhandled exceptions.
        AddHandler currentDomain.UnhandledException, AddressOf OnUnhandledException
        '        AddHandler Application.ThreadException, AddressOf OnUnhandledGUIException

        oLog.LogFilePath = "C:\temp\_logtest.txt"
        oLog.LogLevel = LoggerFactory.INFO_LEVEL

        oLog.info("Info message 1")
        oLog.warn("Warn message 1")
        oLog.fatal("Fatal message 1")
        Try
            Dim count As Integer = 0
            Dim oList As PageList = New PageList("C:\pager\share\pager_codes.txt")
            oList.EnableAutoRefresh = True
            While True
                count += 1
                oLog.info("Loop Count: " & count)
                For i As Integer = 1 To oList.getCount() * 2
                    oLog.info(oList.nextItem())
                Next
                Dim status As String = "OK"
                If oList.hasErrors Then
                    status = "ERROR"
                End If
                oLog.info("Page Read Status: " & status)
                System.Threading.Thread.Sleep(1000)
            End While

        Catch ex As Exception
            oLog.fatal("Unhandled Exception caught. " & ex.Message & vbNewLine & ex.StackTrace.ToString)
            oLog.fatal("Exiting application.")
        Finally

        End Try

    End Sub

    Private Sub OnUnhandledException(ByVal sender As Object, ByVal e As UnhandledExceptionEventArgs)
        oLog.fatal(e.ExceptionObject.ToString)

    End Sub

    Private Sub OnUnhandledGUIException()
        Throw New NotImplementedException
    End Sub


End Module
